<?php

/**
 * news actions.
 *
 * @package    s-test
 * @subpackage news
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class newsActions extends sfActions
{
  public function executeIndex(sfWebRequest $request)
  {
    $this->ktd_newss = Doctrine::getTable('KTDNews')
      ->createQuery('a')
      ->execute();
  }
  public function executeShow(sfWebRequest $request){
    $this->ktd_news = Doctrine::getTable('KTDNews')->find(array($request->getParameter('id')));
    $this->forward404Unless($this->ktd_news, "L'info que vous cherchez n'existe pas ou plus !");
  }

  protected function processForm(sfWebRequest $request, sfForm $form)
  {
    $form->bind($request->getParameter($form->getName()), $request->getFiles($form->getName()));
    if ($form->isValid())
    {
      $ktd_news = $form->save();

      $this->redirect('news/edit?id='.$ktd_news->getId());
    }
  }
}
